package com.yunyao.common.constant.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author xingjishuai
 * @date 2024-08-05
 */
@Getter
public enum ContractPriceType {
    /**
     * 价格类型0=锁定 1=浮动
     */
    LOCK(0, "锁定"),
    FLOAT(1, "浮动");
    private Integer type;
    private String desc;

    ContractPriceType(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static String typeOfDesc(Integer type) {
        if (type == null) {
            return StringUtils.EMPTY;
        }
        for (ContractPriceType contractPriceType : ContractPriceType.values()) {
            if (contractPriceType.getType().equals(type)) {
                return contractPriceType.getDesc();
            }
        }
        return StringUtils.EMPTY;
    }
}
